package com.factory.test.activity;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.factory.test.R;
import com.factory.test.base.BaseTestActivity;
import com.factory.test.databinding.ActivityTpBinding;


/**
 * TP测试
 */
public class TPActivity extends BaseTestActivity {
    private ActivityTpBinding binding;
    private boolean clickTestButton;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_tp);
        binding.setViewClick(new ViewClick());
        //binding.view.setVisibility(View.GONE);
    }

    public class ViewClick {
        public void onStart() {
            clickTestButton = true;
            binding.layout.setVisibility(View.GONE);
            fullscreen(false);      //全屏, 隐藏状态栏及导航栏
            binding.view.setVisibility(View.VISIBLE);
            sdkService.execShell(new String[]{"settings put system pointer_location 1"});
        }

        public void onNext() {
            binding.view.setVisibility(View.GONE);
            binding.layout.setVisibility(View.VISIBLE);
            fullscreen(true);       //显示, 退出全屏
        }
    }


    public void onOK(){
        if(!clickTestButton){
            showError("请先点击 开始测试TP");
            return;
        }

        super.onOK();
    }

    public void onNG(){
        super.onNG();
    }

    @Override
    protected void onPause() {
        super.onPause();
        sdkService.execShell("settings put system pointer_location 0");
        sdkService.execShell("sync");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
